<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>考试列表 - 交通运输人员就业与再就业教育培训平台</title>
    <meta th:replace="~{head/head_include ::  title}"/>
    <link rel="stylesheet" th:href="@{/head_res/bootstrapvalidator/css/form-validation.css}">
    <script type="text/javascript" th:src="@{/head_res/bootstrapvalidator/js/form-validation.js}"></script>
    <script type="text/javascript" charset="utf-8" th:src="@{/head_res/ueditor/ueditor.config.js}"></script>
    <script type="text/javascript" charset="utf-8" th:src="@{/head_res/ueditor/ueditor.all.min.js}"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里更新的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" th:src="@{/head_res/ueditor/lang/zh-cn/zh-cn.js}"></script>
    <script type="text/javascript" th:inline="javascript">
        /* 离开桌面3次,自动提交 */
        var totalCount = 10 ;
        $(function()
        {
            $("#form").FormValidation({
                fields:
                    {
                        /* 名称 */
                        name:
                            {
                                validators: {
                                    notEmpty: {
                                        message: '名称不能为空'
                                    },
                                    stringLength: {
                                        min: 2,
                                        max:200,
                                        message: '名称的长度为在2--200位'
                                    }
                                }
                            }
                    }
            });

            /* 为了确保session不失效;每隔10秒钟请求一次服务器 */
            window.setInterval(function(){
                /* 请求服务器;获取时间 */
                $.post(
                    "${rootPath}/outer/requestOuter.htm",
                    "method=currentDate&json={}",
                    function(data)
                    {
                        $("#spanNow").html(data.data.time);
                    },
                    "json"
                );
            },20000);

            $("#totalCount").html(totalCount);
        });

        var violCount = 0 ;
        /* 违规次数相加 */
        function autoCommitAdd()
        {
            violCount ++ ;
            //alert("==您又违规了;当前次数:"+ violCount +"次,总次数:"+ totalCount +"==");
            console.info(totalCount + "===自动提交检测===" + violCount);
            $("#violCount").html(violCount);
            $("#violCountHid").val(violCount);
            if(violCount >= totalCount)
            {
                alert("==您已经违规"+ totalCount +"次,系统自动提交==");
                $("#form").submit();
                violCount = 0 ;
            }
            return false ;
        }

        /* 违规次数相减 */
        function autoCommitSub()
        {
            console.info("==移除焦点,违规次数减少1次==")
            if(violCount > 0 )
            {
                violCount --  ;
            }
            $("#violCount").html(violCount);
            $("#violCountHid").val(violCount);
        }

        window.onblur = function()
        {
            autoCommitAdd();
        }
    </script>
</head>
<body>
<meta th:replace="~{head/head_include ::  header}"/>
<div class="container">
    <form id="form" class="form-horizontal" th:action="@{/head/train/examScoreDescInsertSubmit}" method="post">
        <input type="hidden" name="entity.examId" th:value="${one.id }">
        <input type="hidden" name="planUsersId" th:value="${param.planUsersId }">
        <div class="row">
            <div class="col-sm-11 col-sm-offset-1">
                <h2 class="form-signin-heading text-center" id="header_title" th:text="${one.name }"></h2>
                <div class="table-responsive mt-2">
                    <table class="table table-striped table-hover">
                        <tbody>
                        <tr>
                            <td>开始时间:<span th:text="${#dates.format(one.stTime,'yyyy-MM-dd HH:mm:ss')}"></span></td>
                            <td>结束时间:<span th:text="${#dates.format(one.edTime,'yyyy-MM-dd HH:mm:ss')}"></span></td>
                            <td>难度:<span th:text="${one.hardStar}"></span></td>
                            <td>类型:<span th:text="${one.examTypeStr}"></span></td>
                            <td>姓名:<span th:text="${session.usersSess.name}"></span></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!-- 单选题 -->
        <div class="row">
            <div class="col-sm-11 col-sm-offset-1 main">
                <h5 class="col-sm-11 col-sm-offset-1 form-signin-heading" id="header_title">选择题(单选)</h5>
                <table class="table table-striped table-hover">
                    <tbody>
                        <th:block th:each="listTemp : ${singleList }">
                            <tr>
                                <td width="50" th:text="${listTempStat.index + 1}"></td>
                                <td th:text="${listTemp.name }">
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <ul class="list-unstyled" th:id="|sel${listTemp.askId }|">
                                        <th:block th:each="childTemp : ${listTemp.askObj?.ansSelList }">
                                            <li>
                                                <label>
                                                    <input type="radio" th:name="|askId_${listTemp.askId}|" th:value="${childTemp.id}"/>
                                                    <span th:text="${childTemp.sn}"></span>
                                                    <span th:text="${childTemp.name}"/>
                                                </label>
                                            </li>
                                        </th:block>
                                    </ul>
                                </td>
                            </tr>
                        </th:block>
                    </tbody>
                </table>
            </div>
        </div>
        <!-- 多选题 -->
        <div class="row">
            <div class="col-sm-11 col-sm-offset-1 main">
                <h5 class="col-sm-11 col-sm-offset-1 form-signin-heading" id="header_title">选择题(多选)</h5>
                <table class="table table-striped table-hover">
                    <tbody>
                        <th:block th:each="listTemp : ${multiList }">
                            <tr>
                                <td width="50" th:text="${listTempStat.index + 1}"></td>
                                <td th:text="${listTemp.name }">
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <td colspan="3">
                                    <ul class="list-unstyled" th:id="|sel${listTemp.askId }|">
                                        <th:block th:each="childTemp : ${listTemp.askObj?.ansSelList }">
                                            <li>
                                                <label>
                                                    <input type="checkbox" th:name="|askId_${listTemp.askId}|" th:value="${childTemp.id}"/>
                                                    <span th:text="${childTemp.sn}"></span>
                                                    <span th:text="${childTemp.name}"/>
                                                </label>
                                            </li>
                                        </th:block>
                                    </ul>
                                </td>
                            </tr>
                        </th:block>
                    </tbody>
                </table>
            </div>
        </div>
        <!-- 判断题 -->
        <div class="row">
            <div class="col-sm-11 col-sm-offset-1 main">
                <h5 class="col-sm-11 col-sm-offset-1 form-signin-heading" id="header_title">判断题(每题分)</h5>
                <table class="table table-striped table-hover">
                    <tbody>
                        <th:block th:each="listTemp : ${pdtList }">
                            <tr>
                                <td width="50" th:text="${listTempStat.index + 1}"></td>
                                <td th:text="${listTemp.name }"></td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <ul class="list-unstyled" th:id="|jude${listTemp.id }|">
                                        <li><label><input type='radio' th:name="|askId_${listTemp.askId }|" value='0'/>&nbsp;&nbsp;正确</label></li>
                                        <li><label><input type='radio' th:name='|askId_${listTemp.askId }|' value='1'/>&nbsp;&nbsp;错误</label></li>
                                    </ul>
                                </td>
                            </tr>
                        </th:block>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-11 col-sm-offset-1 main">
                <div class="form-group">
                    <div class="col-sm-8 col-sm-offset-2">
                        <button class="btn btn-lg btn-primary" type="submit">交卷</button>
                    </div>
                </div>
                <div class="form-group">
                    <label for="currDateStr" class="col-sm-2 control-label">注意事项:</label>
                    <ol class="text-info">
                        <!--<li>上传附件,大于20m无法上传</li>-->
                    </ol>
                </div>
            </div>
        </div>
    </form>
</div>
<meta th:replace="~{head/head_include ::  footer}"/>
</body>
</html>